package ecmnext.utils;

/***************************************************************/
/*                     SOFTWARE SECTION                        */
/***************************************************************/
/*
 * <p>Name: ECMNext</p>
 * <p>Description: Simulation of the platform of trading Software</p>
 * <p>Licence: General Public License</p>
 * <p>Organisation: EC Marseille</p>
 * <p>Persons involved in the project : groupe Plateforme de Trading</p>
 * <p>Current version: 1.0</p>
 */


/***************************************************************/
/*                      IMPORT SECTION                         */
/***************************************************************/

import java.net.*;

/***************************************************************/
/*                  JarClassLoader Class Section               */
/***************************************************************/

/**
 * <p>Title: JarClassLoader</p>
 * <p>Description: This class find and loads class files from jar.</p>
 * @author Xuewen YANG ET Antoine COUDERC
 * @version 1.0
 */

public class JarClassLoader extends URLClassLoader {

  /**
   * Constructor: need a jarPath.
   * @param jarPath String the location of the jar.
   * @throws MalformedURLException if the location is malformed
   */
  public JarClassLoader(String jarPath) throws MalformedURLException {
    super(new URL[] {new URL(jarPath)});
  }

  /**
   * Call this method to load a class from the jar given to the constructor.
   * @param className String the name of the class. (it must contain the 'package path')
   * @throws ClassNotFoundException raised if the class is not found
   * @return Class if the class is found.
   */
  public Class findClass(String className) throws ClassNotFoundException {
    return super.findClass(className);
  }
}
